<?
if ($_GET['debug'] != 1) {
	ob_start();
}
require 'prototype.php';
if ($_GET['debug'] != 1) {
	ob_end_clean();
}
?>
<HTML>
<head>
<script src="http://simile.mit.edu/timeline/api/timeline-api.js" type="text/javascript"></script>
<script type="text/javascript">
var tl;
function onLoad(user) {
	var eventSource = new Timeline.DefaultEventSource(0);

	var theme = Timeline.ClassicTheme.create();
	theme.event.bubble.width = 320;
	theme.event.bubble.height = 220;
	theme.ether.backgroundColors[1] = theme.ether.backgroundColors[0];
	var d = Timeline.DateTime.parseGregorianDateTime("Dec 01 2008")
		var bandInfos = [
		Timeline.createBandInfo({
width:  "10%", 
intervalUnit:   Timeline.DateTime.WEEK, 
intervalPixels: 200,
date:   d,
showEventText:  false,
theme:  theme
}),
		Timeline.createBandInfo({
width:  "90%", 
intervalUnit:   Timeline.DateTime.WEEK, 
intervalPixels: 200,
eventSource:eventSource,
date:   d,
theme:  theme
})
];
bandInfos[0].etherPainter = new Timeline.YearCountEtherPainter({
startDate:  "Dec 01 2008 00:00:00 GMT",
endDate:"Dec 31 2008 00:00:00 GMT",
multiple:   5,
theme:  theme
});
bandInfos[0].syncWith = 1;
bandInfos[0].highlight = true;
bandInfos[0].decorators = [
new Timeline.SpanHighlightDecorator({
startDate:  "Dec 01 2008 00:00:00 GMT",
endDate:"Dec 31 2008 00:00:00 GMT",
startLabel: "first",
endLabel:   "last",
color:  "#FFC080",
opacity:50,
theme:  theme
})
];
tl = Timeline.create(document.getElementById("tl"), bandInfos, Timeline.HORIZONTAL);
tl.loadXML("cache/"+user+".xml", function(xml, url) {
		eventSource.loadXML(xml, url);
		});
}
var resizeTimerID = null;
function onResize() {
	if (resizeTimerID == null) {
		resizeTimerID = window.setTimeout(function() {
				resizeTimerID = null;
				tl.layout();
				}, 600);
	}
}
</script>
</head>
	<body onload="onLoad('<?= str_replace('\'', '', str_replace('"', '', str_replace('\\', '', str_replace('//', '', $_GET['username'])))) ?>');" onresize="onResize();">
	<div id="tl" class="timeline-default" style="height: 400px;">
	</div>
</div>
</body>
</html>
